package net.minecraft.src;

import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.src.forge.GuiControlsScrollPanel;

public class GuiControls extends GuiScreen
{
    private GuiScreen parentScreen;
    protected String screenTitle;
    private GameSettings options;
    private int buttonId;
    private GuiControlsScrollPanel scrollPane;

    public GuiControls(GuiScreen guiscreen, GameSettings gamesettings)
    {
        screenTitle = "Controls";
        buttonId = -1;
        parentScreen = guiscreen;
        options = gamesettings;
    }

    private int func_20080_j()
    {
        return width / 2 - 155;
    }

    public void initGui()
    {
    	scrollPane = new GuiControlsScrollPanel(this, options, mc);
        StringTranslate stringtranslate = StringTranslate.getInstance();
        int i = func_20080_j();
        controlList.add(new GuiButton(200, width / 2 - 100, height - 28, stringtranslate.translateKey("gui.done")));
        scrollPane.registerScrollButtons(controlList, 7, 8);
        screenTitle = stringtranslate.translateKey("controls.title");
    }

    protected void actionPerformed(GuiButton guibutton)
    {
        if (guibutton.id == 200)
        {
            mc.displayGuiScreen(parentScreen);
        }
    }

    protected void mouseClicked(int i, int j, int k)
    {
		super.mouseClicked(i, j, k);
    }

    protected void keyTyped(char c, int i)
    {
        if (scrollPane.keyTyped(c, i))
        {
            super.keyTyped(c, i);
        }
    }

    public void drawScreen(int i, int j, float f)
    {
        drawDefaultBackground();
        scrollPane.drawScreen(i, j, f);
        drawCenteredString(fontRenderer, screenTitle, width / 2, 4, 0xffffff);
        super.drawScreen(i, j, f);
    }
}
